package top.zuli.package01.class04;

import java.util.Arrays;

/**
 * 已知一个数组如下String[] arr = new String[]{"AA","BB","CC","DD","EE"};，
 * 反转arr数组得到如下结果String[] arr = new String[]{"EE","DD","CC","BB","AA"};
 */
public class ArrayTest4 {
    public static void main(String[] args) {
        String[] arr = new String[]{"AA","BB","CC","DD","EE"};
//        int[] arr = new int[]{1,3,5,7};
        for (int i = 0; i < arr.length/2; i++) {
            /*int arr1 = arr[i];
            arr[i] = arr[arr.length-i-1];
            arr[arr.length-i-1] = arr1;*/
            String str = arr[i];
            arr[i] = arr[arr.length-i-1];
            arr[arr.length-i-1] = str;
        }
//        System.out.println(Arrays.toString(arr));
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}
